home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 3 / Amiga Format CD03 (1996-07-04)(Future Publishing)(GB)(Track 1 of 6)[!][issue 1996-08].iso / comms / netsoftware / nethandler.lha / NetHandler / handler / handler.h < prev    next >
C/C++ Source or Header  |  1989-09-16  |  7KB  |  150 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2. /* |_o_o|\\ Copyright (c) 1987 The Software Distillery.  All Rights Reserved */
  3. /* |. o.| || This program may not be distributed without the permission of   */
  4. /* | .  | || the authors:                                          BBS:      */
  5. /* | o  | ||   John Toebes     Dave Baker     John Mainwaring                */
  6. /* |  . |//                                                                  */
  7. /* ======                                                                    */
  8. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  9.  
  10. #include "netcomm.h"
  11.  
  12. /* defines for NetNode status field */
  13. #define NODE_DEAD    0     /* The node has never been heard from       */
  14. #define NODE_UP      1     /* The node is up and responding normally   */
  15. #define NODE_CRASHED 2     /* The node was responding, but is now down */
  16.  
  17.  
  18. /* There is one NetNode structure for each node in the network.  Within*/
  19. /* the NetNode structure is a definition for the NetPtr structure.  A  */
  20. /* NetPtr structure completely describes a FileHandle or Lock on a     */
  21. /* remote system: The NetNode pointer points to the NetNode struct for */
  22. /* the appropriate node;  the RDevice field gives the address ON THE   */
  23. /* REMOTE NODE of the AmigaDOS device to communicate with;  the RPtr   */
  24. /* field gives the address ON THE REMOTE NODE of the FileHandle or Lock*/
  25. /* we are dealing with.  To handle the NULL lock, we put an instance of*/
  26. /* the NetPtr struct in the NetNode struct.  The NetNode field points  */
  27. /* to the top of the struct, the RDevice field is normal and the RPTR  */
  28. /* field is NULL.                                                      */
  29. /* The ioptr field of the NetNode contains information specific to the */
  30. /* communications driver for the node.  I will eventually also put a   */
  31. /* pointer to the MsgPort for the driver once I support multiple       */
  32. /* drivers.                                                            */
  33. struct NetNode
  34. {
  35.    struct NetNode *next;      /* Next Net Node in chain                */
  36.    int status;                /* Last known status - see above         */
  37.    char name[RNAMELEN+2];     /* Name of remote node                   */
  38.    char devname[RNAMELEN+2];  /* TEMPORARY - name of remote device     */
  39.    short id;                  /* ID of remote node (timestamp)         */
  40.    APTR ioptr;                /* Driver-defined pointer                */
  41.    /* The NetPtr instance here is a special case - its NetNode pointer */
  42.    /* points to the root of its own struct, its RPtr pointer is NULL.  */
  43.    /* It is used when a 'template' NETPTR is needed for the net node.  */
  44.    struct NetPtr
  45.    {
  46.       struct NetNode *NetNode;   /* Ptr to network address information     */
  47.       RPTR RDevice;              /* Address of remote MsgPort              */
  48.       RPTR RPtr;                 /* Remote file system's lock/filehandle   */
  49.    } RootLock;
  50. };
  51.  
  52. /* The following typedef is used to represent both remote locks and    */
  53. /* remote filehandles, since the same information is needed for both.  */
  54. /* Using a single struct allows us to use it as a parm to RemotePacket */
  55. /* whether we have a filehandle or a lock.                             */
  56. typedef struct NetPtr *NETPTR;
  57.  
  58. typedef struct global
  59.    {
  60.    struct NetGlobal      n;          /* Globals in common with server      */
  61.    struct RPacket       RP;          /* Data area for remote node          */
  62.    struct DosPacket     *pkt;        /* the packet we are processing       */
  63.    struct DeviceNode    *node;       /* our device node                    */
  64.    struct DeviceList    *volume;     /* currently mounted volume           */
  65.    struct NetNode       netchain;    /* Head of NetNode struct chain       */
  66.    int    numnodes;                  /* Number of nodes in the chain       */
  67.    int    upnodes;                   /* Number of up nodes in the chain    */
  68.    long   unitnum;
  69.    }* GLOBAL;
  70.  
  71. /* file.c */
  72. void ActDelete        U_ARGS((GLOBAL, struct DosPacket *));
  73. void ActRename        U_ARGS((GLOBAL, struct DosPacket *));
  74. void ActSetComment    U_ARGS((GLOBAL, struct DosPacket *));
  75. void ActSetProtection U_ARGS((GLOBAL, struct DosPacket *));
  76. void ActSetFileDate   U_ARGS((GLOBAL, struct DosPacket *));
  77.  
  78. /* io.c */
  79. void ActFindwrite U_ARGS((GLOBAL, struct DosPacket *));
  80. #define ActFindin ActFindWrite
  81. #define ActFindout ActFindWrite
  82. void ActEnd       U_ARGS((GLOBAL, struct DosPacket *));
  83. void ActRead      U_ARGS((GLOBAL, struct DosPacket *));
  84. void ActWrite     U_ARGS((GLOBAL, struct DosPacket *));
  85. void ActSeek      U_ARGS((GLOBAL, struct DosPacket *));
  86.  
  87. /* dir.c */
  88. void ActCreateDir U_ARGS((GLOBAL, struct DosPacket *));
  89. void ActExamine   U_ARGS((GLOBAL, struct DosPacket *));
  90. #define ActExNext ActExamine
  91. void ActParent    U_ARGS((GLOBAL, struct DosPacket *));
  92.  
  93. /* main.c */
  94. void ActSetDebug  U_ARGS((GLOBAL, struct DosPacket *));
  95.  
  96. /* lock.c */
  97. struct FileLock *CreateLock U_ARGS((GLOBAL, NETPTR /* nlock */, 
  98.                                     RPTR /* RLock */, LONG /* Access */));
  99. void FreeLock   U_ARGS((GLOBAL, struct FileLock *));
  100. void ActLock    U_ARGS((GLOBAL, struct DosPacket *));
  101. void ActDupLock U_ARGS((GLOBAL, struct DosPacket *));
  102. void ActUnLock  U_ARGS((GLOBAL, struct DosPacket *));
  103. int ParseName   U_ARGS((GLOBAL, char *, NETPTR *, char *));
  104. struct NetNode *FindNode U_ARGS((GLOBAL, char *));
  105.  
  106. /* Process.c */
  107. void ActDie     U_ARGS((GLOBAL, struct DosPacket *));
  108. void ActInhibit U_ARGS((GLOBAL, struct DosPacket *));
  109. void ActFlush   U_ARGS((GLOBAL, struct DosPacket *));
  110. void ActTimer   U_ARGS((GLOBAL, struct DosPacket *));
  111.  
  112. /* volume.c */
  113. void ActCurentVol  U_ARGS((GLOBAL, struct DosPacket *));
  114. void ActRenameDisk U_ARGS((GLOBAL, struct DosPacket *));
  115. void ActDiskInfo   U_ARGS((GLOBAL, struct DosPacket *));
  116. void ActInfo       U_ARGS((GLOBAL, struct DosPacket *));
  117. void ActNetKludge  U_ARGS((GLOBAL, struct DosPacket *));
  118. void ActDiskChange U_ARGS((GLOBAL, struct DosPacket *));
  119.  
  120. /* device.c */
  121. int GetDevice  U_ARGS((GLOBAL, struct FileSysStartupMsg *));
  122. int InitDevice U_ARGS((GLOBAL));
  123. int TermDevice U_ARGS((GLOBAL));
  124. struct NetNode *AddNode U_ARGS((GLOBAL, char *, APTR));
  125.  
  126. /* Devio.c */
  127. int RemotePacket U_ARGS((GLOBAL, NETPTR));
  128.  
  129. /* inhibit.c */
  130. int inhibit  U_ARGS((struct MsgPort *, long));
  131. long sendpkt U_ARGS((struct MsgPort *, long, long*, long));
  132.  
  133. /* mount.c */
  134. void Mount         U_ARGS((GLOBAL, char *));
  135. void DisMount      U_ARGS((GLOBAL));
  136.  
  137. /* Requester routine */
  138. int  request         U_ARGS((GLOBAL, int, char *));
  139. #define REQ_MUST    0
  140. #define REQ_ERROR   1
  141. #define REQ_GENERAL 2
  142.  
  143. /* Protocol-specific .c file: net#?.c */
  144. InitRDevice U_ARGS((GLOBAL));
  145. TermRDevice U_ARGS((GLOBAL, int));
  146. void ActNetHello   U_ARGS((GLOBAL, struct DosPacket *));
  147.  
  148. #include "/proto.h"
  149.  
  150.